
import time
from pyx_package.script import BaseBehavior
from pyx_package.ps_paramete import PsParameter

PYX_MODULE_NAME = "local-time-hms"

class ScriptBehavior(BaseBehavior):

    def __init__(self) -> None:
        super().__init__()
        
        self.SetExeMode("process")
        self.sp_time = self.CreateParam("cur_time", "cur_time", PsParameter.Output, str, "None")

    def Start(self):

        while 1:
            time.sleep(1)
            self.Ready()

    def DoStep(self):
    
        time_str = time.strftime('%H:%M:%S', time.localtime(time.time()))
        self.sp_time.value = time_str
